﻿@using zichan.Entity
@model IPagedList<UsageLog>
@{
    ViewBag.Title = "Index";
}
<style>
    #pagebar li {
        display: inline-block;
    }
</style>
<div class="portlet">
    <div class="portlet-title">
        <div class="caption ">
            <i class="fa fa-table"></i>使用记录
        </div>
    </div>
    <div class="portlet-body">
        <div class="table-container">
            <div class="dataTables_wrapper dataTables_extended_wrapper no-footer">
                <div class="table-scrollable">
                    <table class="table  table-hover">
                        <thead>
                            <tr class="heading">
                                <th>资产分类</th>
                                <th>资产名称</th>
                                <th>资产编号</th>
                                <th>职员</th>
                                <th>时间</th>
                                <th>操作</th>
                                <th>备注</th>
                            </tr>
                        </thead>
                        <tbody>
                            @foreach (UsageLog r in Model)
                            {
                                <tr>
                                    <td>@r.AssetClassName</td>
                                    <td>@r.AssetName</td>
                                    <td>@r.Code</td>
                                    <td>@r.StaffName</td>
                                    <td>@r.Time</td>
                                    <td>@r.Operation</td>
                                    <td>
                                        @r.Remark
                                    </td>
                                </tr>
                            }
                        </tbody>
                    </table>
                </div>
                @if (Model.PageCount > 1)
                {
                    <div class="row">
                        <div class="col-sm-12 dataTables_paginate">
                            <div class="pull-right">
                                <ul id="pagebar" style="display:inline-block;margin-right:10px;">
                                    <li>
                                        每页<select name="pageSize" id="pageSize" class="select2" style="width:50px;font-size:18px;">
                                            <option value="@ViewBag.pageSize">@ViewBag.pageSize</option>
                                            @foreach (var s in ViewBag.pageSizes)
                                            {
                                                <option value="@s.Value">@s.Text</option>
                                            }
                                        </select>个
                                    </li>
                                    <li>第@(Model.PageNumber)/共@(Model.PageCount)页</li>
                                    @using (Html.BeginForm("index", "UsageLog", FormMethod.Get, new { @style = "display: inline-block;" }))
                                    {
                                        <li style="display:none;">
                                            <input type="hidden" name="pageSize" value="@ViewBag.pageSize" />
                                            @Html.TextBox("pageCount", Model.PageCount)
                                        </li>
                                        <li>跳转至<input name="selectedPage" style="width:40px;font-size:18px;" value="@ViewBag.selectedPage" />页</li>
                                                <li><button type="submit">GO</button></li>}
                                </ul>
                                @if (Model.PageCount > 1)
                                {
                                    <ul id="pagebar" class="pagination" style="margin:0px;float:right;">
                                        <li><a href="@Url.Action("Index", "UsageLog", new { pageSize = ViewBag.pageSize,page = 1 })">首页</a></li>
                                        <li>@Html.ActionLink("上一页", "Index", "UsageLog", new { pageSize = ViewBag.pageSize, page = Model.PageNumber - 1 }, null)</li>
                                        <li>@Html.ActionLink("下一页", "Index", "UsageLog", new { pageSize = ViewBag.pageSize, page = (Model.PageNumber + 1 < Model.PageCount ? Model.PageNumber + 1 : Model.PageCount) }, null)</li>
                                        <li>@Html.ActionLink("末页", "Index", "UsageLog", new { pageSize = ViewBag.pageSize, page = Model.PageCount }, null)</li>
                                    </ul>}
                            </div>

                        </div>
                    </div>
                }

            </div>

        </div>
    </div>
</div>
@section footer{
    <script type="text/javascript">
        $(function () {
            $('#pageSize').on("change", function () {
                var size = $(this).val();
                location.href = "/UsageLog/Index?pageSize=" + size;
            });
        });

    </script>
}